.class public Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;
.super Landroidx/recyclerview/widget/RecyclerView;
.source "ChangeLogRecyclerView.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView$ParseAsyncTask;
    }
.end annotation


# static fields
.field protected static TAG:Ljava/lang/String; = "ChangeLogRecyclerView"


# instance fields
.field protected mAdapter:Lit/gmariotti/changelibs/library/internal/ChangeLogRecyclerViewAdapter;

.field protected mChangeLogFileResourceId:I

.field protected mChangeLogFileResourceUrl:Ljava/lang/String;

.field protected mRowHeaderLayoutId:I

.field protected mRowLayoutId:I


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 1

    const/4 v0, 0x0

    .line 67
    invoke-direct {p0, p1, v0}, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 1

    const/4 v0, 0x0

    .line 71
    invoke-direct {p0, p1, p2, v0}, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
    .locals 0

    .line 75
    invoke-direct {p0, p1, p2, p3}, Landroidx/recyclerview/widget/RecyclerView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 51
    sget p1, Lit/gmariotti/changelibs/library/Constants;->mRowLayoutId:I

    iput p1, p0, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;->mRowLayoutId:I

    .line 52
    sget p1, Lit/gmariotti/changelibs/library/Constants;->mRowHeaderLayoutId:I

    iput p1, p0, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;->mRowHeaderLayoutId:I

    .line 53
    sget p1, Lit/gmariotti/changelibs/library/Constants;->mChangeLogFileResourceId:I

    iput p1, p0, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;->mChangeLogFileResourceId:I

    const/4 p1, 0x0

    .line 54
    iput-object p1, p0, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;->mChangeLogFileResourceUrl:Ljava/lang/String;

    .line 76
    invoke-virtual {p0, p2, p3}, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;->init(Landroid/util/AttributeSet;I)V

    return-void
.end method


# virtual methods
.method protected init(Landroid/util/AttributeSet;I)V
    .locals 0
    .annotation build Landroid/annotation/TargetApi;
        value = 0x15
    .end annotation

    .line 93
    invoke-virtual {p0, p1, p2}, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;->initAttrs(Landroid/util/AttributeSet;I)V

    .line 96
    invoke-virtual {p0}, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;->initAdapter()V

    .line 99
    invoke-virtual {p0}, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;->initLayoutManager()V

    return-void
.end method

.method protected initAdapter()V
    .locals 4

    .line 148
    :try_start_0
    iget-object v0, p0, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;->mChangeLogFileResourceUrl:Ljava/lang/String;

    if-eqz v0, :cond_0

    .line 149
    new-instance v0, Lit/gmariotti/changelibs/library/parser/XmlParser;

    invoke-virtual {p0}, Landroid/view/ViewGroup;->getContext()Landroid/content/Context;

    move-result-object v1

    iget-object v2, p0, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;->mChangeLogFileResourceUrl:Ljava/lang/String;

    invoke-direct {v0, v1, v2}, Lit/gmariotti/changelibs/library/parser/XmlParser;-><init>(Landroid/content/Context;Ljava/lang/String;)V

    goto :goto_0

    .line 151
    :cond_0
    new-instance v0, Lit/gmariotti/changelibs/library/parser/XmlParser;

    invoke-virtual {p0}, Landroid/view/ViewGroup;->getContext()Landroid/content/Context;

    move-result-object v1

    iget v2, p0, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;->mChangeLogFileResourceId:I

    invoke-direct {v0, v1, v2}, Lit/gmariotti/changelibs/library/parser/XmlParser;-><init>(Landroid/content/Context;I)V

    .line 153
    :goto_0
    new-instance v1, Lit/gmariotti/changelibs/library/internal/ChangeLog;

    invoke-direct {v1}, Lit/gmariotti/changelibs/library/internal/ChangeLog;-><init>()V

    .line 156
    new-instance v2, Lit/gmariotti/changelibs/library/internal/ChangeLogRecyclerViewAdapter;

    invoke-virtual {p0}, Landroid/view/ViewGroup;->getContext()Landroid/content/Context;

    move-result-object v3

    invoke-virtual {v1}, Lit/gmariotti/changelibs/library/internal/ChangeLog;->getRows()Ljava/util/LinkedList;

    move-result-object v1

    invoke-direct {v2, v3, v1}, Lit/gmariotti/changelibs/library/internal/ChangeLogRecyclerViewAdapter;-><init>(Landroid/content/Context;Ljava/util/List;)V

    iput-object v2, p0, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;->mAdapter:Lit/gmariotti/changelibs/library/internal/ChangeLogRecyclerViewAdapter;

    .line 157
    iget-object v1, p0, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;->mAdapter:Lit/gmariotti/changelibs/library/internal/ChangeLogRecyclerViewAdapter;

    iget v2, p0, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;->mRowLayoutId:I

    invoke-virtual {v1, v2}, Lit/gmariotti/changelibs/library/internal/ChangeLogRecyclerViewAdapter;->setRowLayoutId(I)V

    .line 158
    iget-object v1, p0, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;->mAdapter:Lit/gmariotti/changelibs/library/internal/ChangeLogRecyclerViewAdapter;

    iget v2, p0, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;->mRowHeaderLayoutId:I

    invoke-virtual {v1, v2}, Lit/gmariotti/changelibs/library/internal/ChangeLogRecyclerViewAdapter;->setRowHeaderLayoutId(I)V

    .line 161
    iget-object v1, p0, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;->mChangeLogFileResourceUrl:Ljava/lang/String;

    if-eqz v1, :cond_2

    iget-object v1, p0, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;->mChangeLogFileResourceUrl:Ljava/lang/String;

    if-eqz v1, :cond_1

    invoke-virtual {p0}, Landroid/view/ViewGroup;->getContext()Landroid/content/Context;

    move-result-object v1

    invoke-static {v1}, Lit/gmariotti/changelibs/library/Util;->isConnected(Landroid/content/Context;)Z

    move-result v1

    if-eqz v1, :cond_1

    goto :goto_1

    .line 164
    :cond_1
    invoke-virtual {p0}, Landroid/view/ViewGroup;->getContext()Landroid/content/Context;

    move-result-object v0

    sget v1, Lit/gmariotti/changelibs/R$string;->changelog_internal_error_internet_connection:I

    const/4 v2, 0x1

    invoke-static {v0, v1, v2}, Landroid/widget/Toast;->makeText(Landroid/content/Context;II)Landroid/widget/Toast;

    move-result-object v0

    invoke-virtual {v0}, Landroid/widget/Toast;->show()V

    goto :goto_2

    .line 162
    :cond_2
    :goto_1
    new-instance v1, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView$ParseAsyncTask;

    iget-object v2, p0, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;->mAdapter:Lit/gmariotti/changelibs/library/internal/ChangeLogRecyclerViewAdapter;

    invoke-direct {v1, p0, v2, v0}, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView$ParseAsyncTask;-><init>(Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;Lit/gmariotti/changelibs/library/internal/ChangeLogRecyclerViewAdapter;Lit/gmariotti/changelibs/library/parser/XmlParser;)V

    const/4 v0, 0x0

    new-array v0, v0, [Ljava/lang/Void;

    invoke-virtual {v1, v0}, Landroid/os/AsyncTask;->execute([Ljava/lang/Object;)Landroid/os/AsyncTask;

    .line 165
    :goto_2
    iget-object v0, p0, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;->mAdapter:Lit/gmariotti/changelibs/library/internal/ChangeLogRecyclerViewAdapter;

    invoke-virtual {p0, v0}, Landroidx/recyclerview/widget/RecyclerView;->setAdapter(Landroidx/recyclerview/widget/RecyclerView$Adapter;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_3

    :catch_0
    move-exception v0

    .line 168
    sget-object v1, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;->TAG:Ljava/lang/String;

    invoke-virtual {p0}, Landroid/view/ViewGroup;->getResources()Landroid/content/res/Resources;

    move-result-object v2

    sget v3, Lit/gmariotti/changelibs/R$string;->changelog_internal_error_parsing:I

    invoke-virtual {v2, v3}, Landroid/content/res/Resources;->getString(I)Ljava/lang/String;

    move-result-object v2

    invoke-static {v1, v2, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    :goto_3
    return-void
.end method

.method protected initAttrs(Landroid/util/AttributeSet;I)V
    .locals 2

    .line 119
    invoke-virtual {p0}, Landroid/view/ViewGroup;->getContext()Landroid/content/Context;

    move-result-object v0

    invoke-virtual {v0}, Landroid/content/Context;->getTheme()Landroid/content/res/Resources$Theme;

    move-result-object v0

    sget-object v1, Lit/gmariotti/changelibs/R$styleable;->ChangeLogListView:[I

    invoke-virtual {v0, p1, v1, p2, p2}, Landroid/content/res/Resources$Theme;->obtainStyledAttributes(Landroid/util/AttributeSet;[III)Landroid/content/res/TypedArray;

    move-result-object p1

    .line 124
    :try_start_0
    sget p2, Lit/gmariotti/changelibs/R$styleable;->ChangeLogListView_rowLayoutId:I

    iget v0, p0, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;->mRowLayoutId:I

    invoke-virtual {p1, p2, v0}, Landroid/content/res/TypedArray;->getResourceId(II)I

    move-result p2

    iput p2, p0, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;->mRowLayoutId:I

    .line 125
    sget p2, Lit/gmariotti/changelibs/R$styleable;->ChangeLogListView_rowHeaderLayoutId:I

    iget v0, p0, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;->mRowHeaderLayoutId:I

    invoke-virtual {p1, p2, v0}, Landroid/content/res/TypedArray;->getResourceId(II)I

    move-result p2

    iput p2, p0, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;->mRowHeaderLayoutId:I

    .line 128
    sget p2, Lit/gmariotti/changelibs/R$styleable;->ChangeLogListView_changeLogFileResourceId:I

    iget v0, p0, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;->mChangeLogFileResourceId:I

    invoke-virtual {p1, p2, v0}, Landroid/content/res/TypedArray;->getResourceId(II)I

    move-result p2

    iput p2, p0, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;->mChangeLogFileResourceId:I

    .line 130
    sget p2, Lit/gmariotti/changelibs/R$styleable;->ChangeLogListView_changeLogFileResourceUrl:I

    invoke-virtual {p1, p2}, Landroid/content/res/TypedArray;->getString(I)Ljava/lang/String;

    move-result-object p2

    iput-object p2, p0, Lit/gmariotti/changelibs/library/view/ChangeLogRecyclerView;->mChangeLogFileResourceUrl:Ljava/lang/String;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 135
    invoke-virtual {p1}, Landroid/content/res/TypedArray;->recycle()V

    return-void

    :catchall_0
    move-exception p2

    invoke-virtual {p1}, Landroid/content/res/TypedArray;->recycle()V

    throw p2
.end method

.method protected initLayoutManager()V
    .locals 2

    .line 107
    new-instance v0, Landroidx/recyclerview/widget/LinearLayoutManager;

    invoke-virtual {p0}, Landroid/view/ViewGroup;->getContext()Landroid/content/Context;

    move-result-object v1

    invoke-direct {v0, v1}, Landroidx/recyclerview/widget/LinearLayoutManager;-><init>(Landroid/content/Context;)V

    const/4 v1, 0x1

    .line 108
    invoke-virtual {v0, v1}, Landroidx/recyclerview/widget/LinearLayoutManager;->setOrientation(I)V

    .line 109
    invoke-virtual {p0, v0}, Landroidx/recyclerview/widget/RecyclerView;->setLayoutManager(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)V

    return-void
.end method
